# -*- coding: utf-8 -*-
"""项目集相关测试用例"""
from projectbusinessflows.base_api import BaseApi


class 查询项目集列表Api(BaseApi):
    def __init__(self):
        super().__init__()
        self.url = f"{self.url}/v1/project/portfolio/list?q=&scope=ROLE&showCompleteTree=true"
        self.method = "get"

class 新建项目集Api(BaseApi):
    def __init__(self,data: dict):
        super().__init__()
        self.url = f"{self.url}/v1/project/portfolio"
        self.method = "post"
        self.json = data

class 删除项目集Api(BaseApi):
    def __init__(self,project_id):
        super().__init__()
        self.url = f"{self.url}/v1/project/portfolio/{project_id}"
        self.method = "delete"

class 下载操作审计文件Api(BaseApi):
    def __init__(self, project_id):
        super().__init__()
        self.url = f"{self.url}/v1/project/portfolio/log/{project_id}/export/excel"
        self.method = "post"



# class 项目集列表:
#
#     def 查询项目集列表(self, cookies):
#         headers = {"Cookie": cookies,
#                    "content_type": "application/json"}
#         res = Requests(headers=headers).get_request(ApiPathExt.查询项目集列表接口)
#         return res
#
#     def 新建项目集(self, cookies, data: dict):
#
#         headers = {"Cookie": cookies,
#                        "content_type": "application/json"}
#         res = Requests(headers=headers).post_request(ApiPathExt.新建项目集接口, json=data)
#         return res
#
#     def 删除项目集(self, cookies, 项目集id: dict):
#
#         headers = {"Cookie": cookies,
#                    "content_type": "application/json"}
#         url = ApiPathExt.删除项目集接口.replace("{{要删除的项目集id}}", f"{项目集id}")
#         res = Requests(headers = headers).delete_request(url)
#         return res
#
#     def 下载操作审计文件(self, cookies):
#
#         headers = {"Cookie": cookies,
#                    "content_type": "application/json"}
#         res = Requests(headers=headers).post_request(ApiPathExt.下载操作审计文件接口)
#         with open(get_path("/data/test_excel.xlsx"),"wb") as f:
#             f.write(res.content)
#         return res
